const winston = require('winston')
const config = require('./serverConfig')

const file = config.logger.file
const level = config.logger.level

const transport = config.logger.file ? 
    new (winston.transports.File)({ filename: file, level: level }) : 
    new (winston.transports.Console)({ level: level })

const logger = new (winston.Logger)({
  transports: [
    transport
  ]
})

module.exports = logger
